<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script type="text/javascript">
        function fun() {
            console.log(this); //this指向的是window对象
            console.log(this.name); //this.name 指的是全局的name
        }
        var obj1 = {
            name: "smyh",
            sayName: fun
        };
        var obj2 = {
            name: "vae",
            sayName: fun
        }
        var name = "全局的name属性";
        fun();
    </script>
</body>

</html>